//author: dschuetz


package com.me.mygdxgame.Components;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;


import com.me.mygdxgame.Component;

public class GUI extends Component
{
	private int healthBarProgress = 0;
	private int healthBarHeight = 2;
	private float HpConvert = 0;
	private Texture healthBarImage;
	private SpriteBatch batch;
	
	Health health = (Health) this.parentObject.getComponent("Health");
	Transform transform = (Transform) this.parentObject.getComponent("Transform");
	
	
	public void create()
	{
		healthBarImage = new Texture(Gdx.files.internal("healthBar.jpg"));
		batch = new SpriteBatch();
	}
	
	
	public void render()
	{
		HpConvert = health.maxHealth/100;
		healthBarProgress = (int) (health.maxHealth/HpConvert);
		
		batch.begin();
		batch.draw(healthBarImage, transform.position.x, transform.position.y, healthBarProgress, healthBarHeight, 0, 0, 841, 595, false, false);
		batch.end();
		
	}
	
	

	

	
	
}
